package cn.com.connected.controller;

import cn.com.connected.base.params.page.BaseSearchDto;
import cn.com.connected.base.params.page.PageResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import cn.com.connected.vo.DynamicCommentVo;
import cn.com.connected.dto.DynamicCommentDto;
import cn.com.connected.dto.search.DynamicCommentSearchDto;
import cn.com.connected.service.DynamicCommentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;



/**
 * 动态评论
 * @author sms
 * @email sms@live.com
 * @date 2025-04-10 16:15:14
 */
@Api(tags = "动态评论")
@RestController
@Slf4j
public class DynamicCommentController extends BaseController  {

    @Autowired
    private DynamicCommentService dynamicCommentService;

    @ApiOperation(value="描述:动态评论添加 ing")
    @RequestMapping(value="/v1/dynamic-comment",method= RequestMethod.POST)
    public DynamicCommentVo dynamicCommentAdd(@RequestBody @Validated DynamicCommentDto dynamicCommentDto) {
        return dynamicCommentService.dynamicCommentAdd(dynamicCommentDto);
    }

    @ApiOperation(value="描述:动态评论详情 ing")
    @RequestMapping(value="/v1/dynamic-comment/{id}",method= RequestMethod.GET)
    public DynamicCommentVo dynamicCommentInfo(@PathVariable("id") String id) {
        return dynamicCommentService.dynamicCommentInfo(id);
    }

    @ApiOperation(value="描述:动态评论编辑 ing")
    @RequestMapping(value="/v1/dynamic-comment/{id}",method= RequestMethod.PUT)
    public void dynamicCommentEdit(@PathVariable("id") String id, @RequestBody @Validated DynamicCommentDto dynamicCommentDto) {
            dynamicCommentService.dynamicCommentEdit(id,dynamicCommentDto);
    }

    @ApiOperation(value="描述:动态评论删除 ing")
    @RequestMapping(value="/v1/dynamic-comment/{id}",method= RequestMethod.DELETE)
    public void dynamicCommentDel(@PathVariable("id") String id) {
            dynamicCommentService.dynamicCommentDel(id);
    }

    @ApiOperation(value="描述:动态评论列表 ing")
    @RequestMapping(value="/v1/dynamic-comments",method= RequestMethod.POST)
    public PageResult<DynamicCommentVo> dynamicComments(@RequestBody BaseSearchDto<DynamicCommentSearchDto> searchParams) {
        return dynamicCommentService.dynamicCommentPage(searchParams);
    }


}
